#!/bin/bash

# 使用 Maven Wrapper 命令
MVN_CMD="./mvnw"

# 清理、运行测试并生成 Allure 报告数据
echo "Running Maven tests and generating Allure results..."
"$MVN_CMD" clean test

# 检查上一步是否成功
if [ $? -ne 0 ]; then
    echo "Maven tests failed. Aborting Allure serve."
    exit 1
fi

# 启动 Allure 报告服务
echo "Serving Allure report..."
"$MVN_CMD" allure:serve